function getXMLHTTP() { //fuction to return the xml http object
    var xmlhttp=false;	
    try{
        xmlhttp=new XMLHttpRequest();
    }
    catch(e)	{		
        try{			
            xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch(e){
            try{
                xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
            }
            catch(e1){
                xmlhttp=false;
            }
        }
    }
		 	
    return xmlhttp;
}
	
function getCarModel(makeID,baseUrl) {
   
    var strURL=baseUrl+"ajax/populate_cal_model?make="+makeID;
    var req = getXMLHTTP();
    if (req) {
        req.onreadystatechange = function() {
            if (req.readyState == 4) {
                if (req.status == 200) {
                    
                        document.getElementById('modeldiv').innerHTML=req.responseText;
                } else {
                    
                    alert("There was a problem while using Car Model:\n" + req.statusText);
                }
            }				
        }			
        req.open("GET", strURL, true);
        req.send(null);
    }
   
}

function getCarVersion(modelID,baseUrl) {		
    var strURL=baseUrl+"ajax/populate_car_version?model="+modelID;
    var req = getXMLHTTP();
    //alert(strURL);
    if (req) {
        req.onreadystatechange = function() {
            if (req.readyState == 4) {
            //alert(req.status);                                
                if (req.status == 200) {
                        document.getElementById('versiondiv').innerHTML=req.responseText;
                } else {
                    alert("There was a problem while using Car Version:\n" + req.statusText);
                }
            }				
        }			
        req.open("GET", strURL, true);
        req.send(null);
    }
    
    
    
}


function getCity_dealer(stateId,baseUrl) {		
    var strURL=baseUrl+"ajax/populate_city_dealer?state="+stateId;
    var req = getXMLHTTP();
    if (req) {
        req.onreadystatechange = function() {
            if (req.readyState == 4) {
                if (req.status == 200) {
                        document.getElementById('cityddiv').innerHTML=req.responseText;
                } else {
                    alert("There was a problem while using City:\n" + req.statusText);
                }
            }				
        }			
        req.open("GET", strURL, true);
        req.send(null);
    }
}



	
